home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Graphics / include / vector_3d.h < prev   
Encoding:
Text File  |  1995-03-25  |  2.8 KB  |  52 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    vector_3d.h
  3. //    Date:                    8/26/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a vector_3d
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include "tuple_3d.h"
  11.  
  12. #ifndef    VECTOR_3D
  13. #define    VECTOR_3D
  14.  
  15. //------------------------------------------------------------------------------
  16. //    classes
  17. //------------------------------------------------------------------------------
  18. #ifndef    POINT_3D
  19. class    point_3d;                                                                                                                                    //    forward declaration
  20. #endif
  21.  
  22. //------------------------------------------------------------------------------
  23. class    vector_3d : public tuple_3d                                                                                                //    4 dimensional vector_3d class
  24. {                                                                                                                                                                //    begin vector_3d class definition
  25.     public:                                                                                                                                                //    public interface
  26.         vector_3d (void) {}                                                                                                                    //    default constructor
  27.         vector_3d (real x, real y, real z, real w = R(0.0));                                                //    constructor from 4 values
  28.         vector_3d (const vector_3d &v);                                                                                            //    copy constructor
  29.         vector_3d (const point_3d &p);                                                                                            //    constructor from a point_3d
  30.         vector_3d (const tuple_3d &t);                                                                                            //    constructor from a tuple_3d
  31.         vector_3d    &operator = (const vector_3d &v);                                                                    //    assignment operator
  32.         vector_3d    &operator = (const tuple_3d &t);                                                                    //    assignment operator
  33.         void            operator () (real x, real y, real z, real w = R(0.0));                        //    function call operator
  34.         vector_3d operator * (real s) const;                                                                                //    scalar multiplication
  35.         vector_3d operator / (real s) const;                                                                                //    scalar division
  36.         vector_3d    operator ^ (const vector_3d &v) const;                                                        //    cross product
  37.         vector_3d    operator + (const vector_3d &v) const;                                                        //    addition operator
  38.         vector_3d    &operator += (const vector_3d &v);                                                                //    self addition operator
  39.         vector_3d    operator - (const vector_3d &v) const;                                                        //    subtraction operator
  40.         vector_3d    operator - (void) const;                                                                                    //    unary minus operator
  41.         real            Norm (void) const;                                                                                                //    compute the length of the vector_3d
  42.         vector_3d    &Normalize (void);                                                                                                //    reduce the vector_3d to length 1.0
  43. };                                                                                                                                                            //    end vector_3d class definition
  44.  
  45. //------------------------------------------------------------------------------
  46. //    global variables
  47. //------------------------------------------------------------------------------
  48. extern    vector_3d    ZERO_VECTOR;                                                                                                    //    a zero value vector_3d
  49.  
  50. //------------------------------------------------------------------------------
  51.  
  52. #endif    //VECTOR_3D